// 本组件是合同和补充协议的操作，补充协议与合同除了要保存字段的变化（getChangeField方法）其他完全一致， // 所以在保存提交等方法做了针对两种类型不同的一些校验，路由上有isAgreement代表补充协议,classification字段supplement代表是补充协议，master代表主合同
<template>
  <div class="tabs pad-out-box">
    <el-container class="conheigth">
      <!-- tab -->
      <el-header>
        <el-tabs v-model="activeName" @tab-click="tabClick">
          <template v-for="(item, index) in tabList">
            <el-tab-pane :key="index" :label="item.label" :name="item.name"> </el-tab-pane>
          </template>
        </el-tabs>
      </el-header>

      <!-- 按钮组,不是从代办列表中点进来的才可能显示按钮  ifTermination:true代表没有在流程中的废纸合同,能提废纸合同的流程，说明没有在流程中的废纸合同 contractCategory:1是收入2是支出-->
      <div class="btn-box" v-if="!$route.query.isTodo">
        <el-button v-if="!contractInfo.contractStatus || $route.query.isAgreement || contractInfo.contractStatus == 3" type="primary" size="mini" @click="saveFn('audit')">提交</el-button>
        <el-button v-if="!contractInfo.contractStatus || $route.query.isAgreement || contractInfo.contractStatus == 3" type="primary" size="mini" @click="saveFn">保存</el-button>
        <el-button v-if="(contractInfo.contractStatus == 2 && !$route.query.isAgreement && contractInfo.ifTermination && !$route.query.processCode) || $route.query.abolish" type="primary" size="mini" @click="abolishContract">废止合同</el-button>
        <el-button v-if="contractInfo.contractStatus == 2 && !$route.query.isAgreement && contractInfo.classification != 'supplement' && !$route.query.processCode && !$route.query.abolish" type="primary" size="mini" @click="addAgreement">新增补充协议</el-button>
        <el-button v-if="contractInfo.contractStatus == 2 && !$route.query.isAgreement && contractInfo.contractCategory == '2' && !$route.query.processCode" type="primary" size="mini" @click="applyPayFn">申请付款</el-button>
      </div>

      <!-- 内容区 -->
      <el-main class="scrollBox">
        <template v-for="(item, i) in tabList">
          <components :is-info="$route.query.isInfo" :contract-type="$route.query.contractType" :key="i" :id="item.name" :ref="item.name" :is="item.name" :contract-info="contractInfo" :dictory-list="dictoryList" :is-contract="true" :is-first="isFirst" :chose-project-key="currentProjectKey" :chose-begin-date="currentContractBeginDate" :chose-end-date="currentContractEndDate" @setDeviceNum="getDeviceNum" @setRentMode="getRentMode" @setBaseParams="setBaseParams"></components>
        </template>
      </el-main>
    </el-container>
    <abolish-contract ref="abolishContract" :contract-type="contractInfo.contractType" @getInfo="getInfo"></abolish-contract>
    <verify-contract ref="verifyContract" :contract-type="contractInfo.contractType" :contract-info="contractInfo" :attention-txt="attentionTxt" @verifySave="submitFn"></verify-contract>
    <apply-pay ref="applyPay" :contractInfo="contractInfo" :is-info="$route.query.isInfo"></apply-pay>
  </div>
</template>
<script>
  //contractStatus: 0 草稿 1 审批中 2 审批完成/履行中 3 驳回 4 履行完毕 5 已废止
  //租赁类ZL  广告位GGZL  临时场地LSCD  无人设备场地租赁WRSB  停车场代运营TCCYY  其他QTSR  物业外包人员ZX  易耗品采购GC  设施设备保养维修TG  各类检测XZ  其他事项合同CW  能耗代运营YY
  import merge from 'webpack-merge';
  import baseInfo from './baseInfo.vue';
  import financePlan from './financePlan.vue';
  import cost from './cost.vue';
  import abolishContract from './abolishContract.vue';
  import verifyContract from './verifyContract.vue';
  import applyPay from './applyPay.vue';
  import contractFile from './contractFile';
  import approveInfo from '../../approvalPage/approveInfo.vue';
  import { requestTips, askDialog } from '../../../assets/util';
  import * as Plan from './financePlan.js';
  import utils from '@/common/js/utils.js';
  import { accAdd, accMul, accDiv } from '@/common/js/utils.js';

  import { apiContrantinfo, apiDictMoreList, apiContrantAdd, apiContrantUpdate, apiProjectList, apiVerifyPlan, apiUnpaidAmount, apiInitiate, apiSaveSupplement, apiShopList, apiGetPayContractCharge } from '../../../api/contract';
  import { apiCreateAudit } from '../../../api/common';
  import { apiCheckBillList } from '../../../api/acceptance';
  import { DASE_INFO, PARTNER_LIST } from '@/pages/businessAssets/config';
  import $ from 'jquery';

  export default {
    data() {
      return {
        activeName: 'baseInfo',
        tabList: {
          baseInfo: { name: 'baseInfo', label: '基本信息' },
          financePlan: { name: 'financePlan', label: '财务与计划' },
          cost: { name: 'cost', label: '合同费用约定' },
          contractFile: { name: 'contractFile', label: '合同附件' },
        },
        contractInfo: { projectKey: '', contractKey: '', contractCode: '', contractCategory: '', contractType: '' },
        mainContractInfo: {}, //主合同信息
        dictoryList: [],
        verifyDialog: false,
        attentionTxt: '',
        currentProjectKey: '', //基本信息中选择的项目key
        currentContractBeginDate: null, //基本信息中选择的开始时间
        currentContractEndDate: null, //基本信息中选择的结束时间
        provideObj: {}, //祖孙传值
        isFirst: true, //判断是否刚加载页面，用于子组件的watch中的方法执行
        payContractChargeList:[] //支出合同申请付款的事项
      };
    },

    async mounted() {
      this.initTab();
      await this.getOptionList();
      this.$route.query.isInfo && this.getPayContractCharge();
      this.$route.query.isInfo && this.getInfo();
    },

    provide() {
      return {
        provideObj: this.provideObj,
      };
    },

    methods: {
      initTab() {
        if (this.$route.query.isAgreement) {
          document.title = '补充协议';
        }
        if (this.$route.query.taskId) {
          this.tabList.approveInfo = { name: 'approveInfo', label: '审批信息' };
        }
      },
      // 无人设备-经营信息-数量
      getDeviceNum(deviceNum) {
        this.$set(this.provideObj, 'deviceNum', deviceNum);
      },
      // 无人设备-经营信息-数量
      getRentMode(rentMode) {
        this.$set(this.provideObj, 'rentMode', rentMode);
      },
      //字典
      async getOptionList() {
        let res = await apiDictMoreList({ dictTypeList: ['contractType', 'rentMode', 'rentCollectionCycle', 'costType', 'subsidyItem', 'giveAwayItem', 'energyShare', 'deviceType', 'paymentFrequency', 'space_type', 'industry_type', 'classification'] });
        this.dictoryList = res.rows || [];
        this.dictoryList.forEach(item => {
          if (item.dictType == 'rentCollectionCycle') {
            this.$set(this.provideObj, 'periodList', item.dictList); //付款周期
          }
        });
      },
      //合同信息
      async getInfo() {
        let res = await apiContrantinfo({
          primaryKey: this.$route.query.contractKey || this.contractInfo.contractKey,
        });
        if (res.contractRentInfo && res.contractRentInfo.rentMode) {
          this.getRentMode(res.contractRentInfo.rentMode);
        }
        this.backFieldHandle(res);
        this.getAssetOptions(res);
        this.contractInfo = res;
        //主合同信息,补充协议时,linkedContract:主合同的key
        if (res.linkedContract) {
          if (!res.contractStatus) {
            this.getMainContract(res.linkedContract);
          }
        } else {
          this.mainContractInfo = JSON.parse(JSON.stringify(res));
        }
        setTimeout(() => {
          this.isFirst = false;
        }, 1500);
      },
      //主合同信息
      async getMainContract(key) {
        let res = await apiContrantinfo({
          primaryKey: key,
        });
        this.backFieldHandle(res);
        this.mainContractInfo = JSON.parse(JSON.stringify(res));
      },
      //资产信息的选择资产下拉框数据源回显
      getAssetOptions(res) {
        if (res.rentCycleList && res.rentCycleList.length > 0) {
          res.rentCycleList.forEach(async item => {
            item.assetList = [];
            item.assetList = await this.getAssetList(item.rentStartDate, item.rentEndDate, res.primaryKey, res.contractStatus);
          });
        }
      },
      //查资产
      async getAssetList(rentStartDate, rentEndDate, projectKey, contractStatus) {
        let isUse = null;
        if (this.$route.query.isAgreement) {
          //isAgreement代表补充协议
          isUse = 1;
        } else {
          isUse = !contractStatus || contractStatus == 3 ? 1 : null;
        }
        let res = await apiShopList({
          projectKey: projectKey,
          startDate: rentStartDate,
          endDate: rentEndDate,
          isUse: isUse,
        });
        return res.rows || [];
      },
      //一些字段回显的特殊处理
      backFieldHandle(res) {
        res.ifFrameworkContract = String(res.ifFrameworkContract);
        res.ifStandardContract = String(res.ifStandardContract);
        //租赁合同的基本信息的一些字段处理
        if (res.contractRentInfo && res.contractRentInfo.managementFeeIncrementalPercent) {
          res.contractRentInfo.ifMainStore = String(res.contractRentInfo.ifMainStore);
          res.contractRentInfo.rentFeeIncrementalPercent = accMul(Number(res.contractRentInfo.rentFeeIncrementalPercent), 100);
          res.contractRentInfo.managementFeeIncrementalPercent = accMul(Number(res.contractRentInfo.managementFeeIncrementalPercent), 100);
        }
        //设置结束时间的options
        setTimeout(() => {
          this.setOptions(res.fixedRentList, 'fixed');
          this.setOptions(res.shareRentList, 'share');
          this.setOptions(res.manageRentList, 'manage');
        }, 1000);
      },
      //设置结束时间的options
      setOptions(list, refName) {
        if (list && list.length > 0) {
          list.forEach(item => {
            item.endList = [];
            this.$refs.cost[0].$refs[refName].getEndDate(item);
          });
        }
      },
      //合同提交前校验计划相关
      async verifyPlan(model) {
        let res = await apiVerifyPlan(model);
        if (res.success) {
          this.submitFn();
        } else {
          this.attentionTxt = res.message;
          this.$refs.verifyContract.dialogShow = true;
        }
      },
      //提审方法
      async submitFn() {
        let infoData = this.$refs.baseInfo[0].saveFn(); //基础信息
        let userInfo = JSON.parse(localStorage.getItem('userInfo'));
        let param = {
          businessKey: this.contractInfo.contractKey || this.$route.query.contractKey, //合同key
          userPrimaryKey: userInfo.key,
          projectKey: infoData[DASE_INFO].projectKey,
          type: '合同', //合同,账单,付款,合同终止
          typeKey: this.$route.query.isAgreement || this.contractInfo.classification == 'supplement' ? 'contractSupplement' : 'contractSubmit', //contractSubmit,bill,payment,contractTermination,contractSupplement:补充协议
        };
        let res = await apiCreateAudit(param);
        requestTips(res, async () => {
          // isAgreement代表是补充协议
          if (this.$route.query.isAgreement) {
            this.$router.replace({
              query: merge(this.$route.query, { isAgreement: '' }),
            });
            setTimeout(() => {
              window.location.reload();
            }, 500);
          } else {
            this.$router.replace({
              query: merge(this.$route.query, { isInfo: true, contractKey: this.contractInfo.contractKey }),
            });
            this.getInfo();
          }
        });
      },
      //校验合同费用约定的必填
      validateMustCost() {
        for (let i = 0, len = $('.yj-input').find('.el-input__inner').length; i < len; i++) {
          let item = $('.yj-input').find('.el-input__inner')[i];
          if ($(item).val() == '' && !$(item).attr('disabled') && $(item).attr('disabled') != 'disabled' && !$(item).attr('readonly') && $(item).attr('readonly') != 'readonly') {
            $(item).css('border-color', 'red');
            return false;
          } else {
            $(item).css('border-color', '#DCDFE6');
          }
        }
        return true;
      },
      //保存 | 提审方法
      async saveFn(type) {
        // 校验,不一起校验判断是应为提示语的先后问题，先校验基本信息中的必填（代码顺序不要变）
        let infoData = this.$refs.baseInfo[0].saveFn(type); //基础信息
        if (infoData === false) {
          return;
        }
        let planData = this.$refs.financePlan[0].saveFn(type); //对方信息
        if (planData === false) {
          return;
        }
        let fileData = this.$refs.contractFile[0].saveFn(); //附件信息
        //费用信息校验
        if (type == 'audit') {
          let validateMustCost = this.validateMustCost();
          if (!validateMustCost) {
            this.$message.warning('请检查合同费用约定的必填项！！');
            return;
          }
        }
        //费用信息
        let costData = this.$route.query.contractType == 'ZL' || this.$route.query.contractType == 'WRSB' ? this.$refs.cost[0].saveFn() : true;
        if (fileData === false || costData === false) {
          return;
        }
        //拼装接口需要的参数
        let params = infoData[DASE_INFO];
        params[PARTNER_LIST] = infoData[PARTNER_LIST];
        params.contractType = this.$route.query.contractType;
        for (let i in planData) {
          params[i] = planData[i];
        }
        for (let i in fileData) {
          params[i] = fileData[i];
        }
        for (let i in costData) {
          params[i] = costData[i];
        }
        let model = JSON.parse(JSON.stringify(params));

        if (type == 'audit') {
          askDialog('确认提交？', async () => {
            this.inParamsDo(model, type);
          });
        } else {
          this.inParamsDo(model, type);
        }
      },
      //保存 ｜ 提审的数据入库
      async inParamsDo(model, type) {
        //租赁合同处理百分比的数据，要除100
        if (model.contractType == 'ZL') {
          this.percentageDo(model);
        }
        let res = {};
        //如果是补充协议的话
        if (this.$route.query.isAgreement) {
          model.linkedContract = this.$route.query.contractKey;
          res = await apiContrantAdd(model);
        } else {
          model.primaryKey = this.contractInfo.primaryKey;
          model.contractCategory = this.contractInfo.contractCategory;
          model.linkedContract = this.contractInfo.linkedContract;
          res = this.contractInfo.primaryKey ? await apiContrantUpdate(model) : await apiContrantAdd(model);
        }
        if (res.success) {
          if (!this.contractInfo.primaryKey || this.$route.query.isAgreement) {
            this.contractInfo.contractKey = res.key;
            this.contractInfo.contractCode = res.extend.contractCode;
            this.contractInfo.contractCategory = res.extend.contractCategory;
          }
          //type == 'audit'是提审
          if (type == 'audit') {
            //补充协议存差别字段入库
            if (this.contractInfo.linkedContract || this.$route.query.isAgreement) {
              this.getChangeField(model);
            }
            //提审前校验
            model.contractCode = res.extend.contractCode || this.contractInfo.contractCode;
            this.verifyPlan(model);
          } else {
            let updateParam = { isInfo: true, contractKey: res.key };
            if (this.$route.query.isAgreement) {
              updateParam.isAgreement = '';
            }
            requestTips(res, () => {
              this.$router.replace({
                query: merge(this.$route.query, updateParam),
              });
              this.getInfo();
            });
          }
        } else {
          this.$message.error(res.message);
        }
      },
      //补充协议变化的字段数据
      async getChangeField(model) {
        let differenceList = [];
        let contractType = this.$route.query.contractType;
        //合并所有的字段集合
        let allFieldList = [...Plan.leaseBasePlanFiledList, ...Plan.lscdLeasePlanFiledList, , ...Plan.lscdGatheringPlanFiledList, ...Plan.qtsrOtherPlanFiledList, , ...Plan.qtsrPayPlanFiledList, , ...Plan.tccdyyOtherPlanFiledList, ...Plan.tccdyyGatheringPlanFiledList, , ...Plan.zchtPlanFiledList, , ...Plan.ggwxxPlanFiledList];
        let oldParam = this.mainContractInfo;
        let nowParam = JSON.parse(JSON.stringify(model));
        let throwParamList = ['partnerList', 'fundsPlanList', 'rentAssetsList', 'rentCostList', 'approvalSupportAttachmentList', 'contractAttachmentList', 'masterContractAttachmentList'];
        //从遍历所有字段集合开始

        allFieldList.forEach(filed => {
          //租赁合同类型的财务的基本信息
          if (contractType == 'ZL') {
            for (let i in nowParam.contractRentInfo) {
              if (filed.bindFieldName == i) {
                if (i == 'rentFeeIncrementalPercent' || i == 'managementFeeIncrementalPercent') {
                  nowParam.contractRentInfo[i] = accMul(Number(nowParam.contractRentInfo[i]), 100);
                }
                if ((nowParam.contractRentInfo[i] || oldParam.contractRentInfo[i]) && nowParam.contractRentInfo[i] != oldParam.contractRentInfo[i]) {
                  let param = {
                    contractKey: this.mainContractInfo.primaryKey,
                    fieldKey: i,
                    fieldName: filed.label,
                  };
                  this.setValByInputType(param, filed, oldParam.contractRentInfo[i], nowParam.contractRentInfo[i]);
                  differenceList.push(param);
                }
              }
            }
          }
          throwParamList.forEach(listname => {
            nowParam[listname] &&
              nowParam[listname].forEach(asset => {
                oldParam[listname] &&
                  oldParam[listname].forEach(oldAsset => {
                    // 租赁合同
                    if (contractType == 'ZL') {
                      //资产信息
                      if (listname == 'rentAssetsList') {
                        if (oldAsset.shopKey == asset.shopKey) {
                          this.setParam(filed, asset, oldAsset, differenceList);
                        }
                      }
                    }
                  });
              });
          });
        });
        // 租赁合同的租赁成本
        if (contractType == 'ZL') {
          this.getMoneyChange(oldParam.rentCostList, nowParam.rentCostList, 'costAmount', '成本金额', differenceList);
        }
        // 广告合同
        if (contractType == 'GGZL') {
          //收款计划
          this.getMoneyChange(oldParam.fundsPlanList, nowParam.fundsPlanList, 'fundsAmount', '付款金额(含税)', differenceList);
          //广告位信息
          this.getMoneyChange(oldParam.rentAssetsList, nowParam.rentAssetsList, 'contractAmount', '合同金额', differenceList);
        }
        // 临时场地合同
        if (contractType == 'LSCD') {
          //收款计划
          this.getMoneyChange(oldParam.fundsPlanList, nowParam.fundsPlanList, 'fundsAmount', '预估收款金额', differenceList);
          //租赁信息
          this.getMoneyChange(oldParam.rentAssetsList, nowParam.rentAssetsList, 'contractAmount', '合同金额', differenceList);
        }
        // 无人设备合同
        if (contractType == 'WRSB') {
          //租赁信息
          this.getMoneyChange(oldParam.rentAssetsList, nowParam.rentAssetsList, 'deviceNum', '数量', differenceList);
          this.getMoneyChange(oldParam.rentAssetsList, nowParam.rentAssetsList, 'approximateArea', '大体面积', differenceList);
        }
        // 停车场合同
        if (contractType == 'TCCYY') {
          //收款计划
          this.getMoneyChange(oldParam.fundsPlanList, nowParam.fundsPlanList, 'fundsAmount', '预估收款金额', differenceList);
          //租赁信息
          this.getMoneyChange(oldParam.rentAssetsList, nowParam.rentAssetsList, 'rentAmount', '租金金额', differenceList);
        }
        // 其他收入合同
        if (contractType == 'QTSR' || contractType == 'ZX' || contractType == 'GC' || contractType == 'TG' || contractType == 'XZ' || contractType == 'CW' || contractType == 'YY') {
          //付款计划
          this.getMoneyChange(oldParam.fundsPlanList, nowParam.fundsPlanList, 'fundsAmount', '预估收款金额', differenceList);
        }
        console.log(differenceList);
        let res = await apiSaveSupplement({ list: differenceList });
      },
      // 有关比较数字（Ex：金额，个数）总和的变化通用
      getMoneyChange(oldList, newList, moneyField, moneyFieldTxt, differenceList) {
        let oldMoney = oldList.reduce((prev, cur) => {
          return accAdd(prev, Number(cur[moneyField]));
        }, 0);
        let newMoney = newList.reduce((prev, cur) => {
          return accAdd(prev, Number(cur[moneyField]));
        }, 0);
        if (oldMoney != newMoney) {
          differenceList.push({
            contractKey: this.mainContractInfo.primaryKey,
            fieldKey: moneyField,
            fieldName: moneyFieldTxt,
            valueBefore: oldMoney,
            valueAfter: newMoney,
          });
        }
      },
      //接口所需要的参数，不同合同类型的判断条件不同，所以抽出公用的set值的函数(只对带添加按钮的)
      //filed:js中维护的字段集 asset：补充建议中的对象，新的 oldAsset：主合同中的对象，旧的 differenceList:最终的传给后端的list
      setParam(filed, asset, oldAsset, differenceList) {
        for (let i in asset) {
          if (filed.bindFieldName == i) {
            if ((asset[i] || oldAsset[i]) && asset[i] != oldAsset[i]) {
              let param = {
                contractKey: this.mainContractInfo.primaryKey,
                bizId: oldAsset.primaryKey,
                bizType: this.mainContractInfo.contractType,
                fieldKey: i,
                fieldName: filed.label,
              };
              this.setValByInputType(param, filed, oldAsset[i], asset[i]);
              differenceList.push(param);
            }
          }
        }
      },
      //根据input类型进行赋值
      setValByInputType(param, filed, oldKey, nowKey) {
        if (filed.type == 'select' || filed.type == 'checkbox' || filed.type == 'radio') {
          param.valueBefore = this.getOptionTxt(filed.optionList, filed.keyName, filed.valName, oldKey);
          param.valueAfter = this.getOptionTxt(filed.optionList, filed.keyName, filed.valName, nowKey);
        } else if (filed.type == 'date') {
          param.valueBefore = oldKey ? utils.formDataDate(Number(oldKey)) : '';
          param.valueAfter = nowKey ? utils.formDataDate(Number(nowKey)) : '';
        } else {
          param.valueBefore = oldKey;
          param.valueAfter = nowKey;
        }
      },
      //取select的指定汉字
      getOptionTxt(list, keyName, valName, key) {
        let val = '';
        list.forEach(item => {
          if (item[keyName] == key) {
            val = item[valName];
          }
        });
        return val;
      },
      //关闭本页面
      closePage() {
        setTimeout(() => {
          window.close();
        }, 800);
      },
      tabClick(tab) {
        const a = document.createElement('a'); // 创建a标签
        a.setAttribute('href', '#' + tab.name); // href链接
        a.click(); // 自执行点击事件
      },
      //废止合同
      abolishContract() {
        this.$refs.abolishContract.dialogShow = true;
        this.$refs.abolishContract.fileList = [];
      },
      //新增补充协议
      addAgreement() {
        this.$router.replace({
          query: merge(this.$route.query, { isAgreement: true }),
        });
        window.location.reload();
      },
      //申请付款
      async applyPayFn() {
        const [unpaidAmount, acceptanceList] = await Promise.all([this.getUnpaidAmount(), this.getAcceptance()]);
        this.$refs.applyPay.dialogShow = true;
        this.$nextTick(() => {
          this.$refs.applyPay.fileList = [];
          this.$refs.applyPay.initFieldVal(unpaidAmount, acceptanceList, this.payContractChargeList);
        });
      },
      //取值剩余未付金额
      async getUnpaidAmount() {
        return new Promise(async (resolve, reject) => {
          let res = await apiUnpaidAmount({ contractKey: this.$route.query.contractKey });
          resolve(Number(res.unpaidAmount) || 0);
        });
      },
      //取值关联验收单
      async getAcceptance() {
        let projectKey = this.getProjectKey();
        return new Promise(async (resolve, reject) => {
          let res = await apiCheckBillList({ projectKey: projectKey });
          resolve(res.rows || []);
        });
      },
      //支出合同申请付款的事项
      async getPayContractCharge() {
        let res = await apiGetPayContractCharge({ contractKey: this.$route.query.contractKey });
        this.payContractChargeList = res.rows || []
      },
      //取选择的项目key
      getProjectKey() {
        let infoData = this.$refs.baseInfo[0].saveFn(); //基础信息
        return infoData[DASE_INFO].projectKey;
      },
      //取选择的部门key
      getOrgKey() {
        let infoData = this.$refs.baseInfo[0].saveFn(); //基础信息
        return infoData[DASE_INFO].orgKey;
      },
      //项目选择变化的时候
      setBaseParams(type, data) {
        this[type] = data;
      },
      //特殊处理百分比除100
      percentageDo(model) {
        let rentFeeIncrementalPercent = model.contractRentInfo.rentFeeIncrementalPercent; //租金递增百分比
        let managementFeeIncrementalPercent = model.contractRentInfo.managementFeeIncrementalPercent; //管理费递增百分比
        model.contractRentInfo.rentFeeIncrementalPercent = rentFeeIncrementalPercent ? accDiv(Number(rentFeeIncrementalPercent), 100) : 0;
        model.contractRentInfo.managementFeeIncrementalPercent = managementFeeIncrementalPercent ? accDiv(Number(managementFeeIncrementalPercent), 100) : 0;
      },
      // 合同费用约定
      setCostTab() {
        if (this.$route.query.contractType != 'ZL' && this.$route.query.contractType != 'WRSB') {
          delete this.tabList.cost;
        }
      },
    },

    created() {
      this.setCostTab();
    },

    components: { baseInfo, financePlan, contractFile, abolishContract, applyPay, approveInfo, verifyContract, cost },
  };
</script>
<style lang="scss" scoped>
  .tabs {
    position: relative;
    .btn-box {
      position: absolute;
      top: 24px;
      right: 30px;
    }
    .left-lable {
      width: 120px;
      font-size: 16px;
      font-weight: 550;
    }
    .record-item {
      padding-bottom: 10px;
    }
    .conheigth {
      height: calc(100vh - 100px);
    }
  }
  ::v-deep .el-form .el-form-item__label {
    padding-left: 0;
  }
</style>
